package EjemplosEventosBasicos;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;


public class EjemploActionListener {
	
	public void montarVentana (){
		JFrame frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JButton boton = new JButton("Boton");
		
		boton.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent e) {
				System.out.println("Hello World");
				
			}
			
		});
		
		boton.addActionListener(new EjemploActionListener2());
		
		frame.add(boton);
		frame.setVisible(true);
		frame.pack();
	}
	
	public static void main (String[] args){
		EjemploActionListener eal = new EjemploActionListener();
		eal.montarVentana();
	}
}
